<?php

namespace App\Traits;

use Illuminate\Support\Facades\DB;

trait SystemCodeTrait
{
    //public $sysCodeColumn = 'uuid';

    public function getApplyNewCode($year, $number)
    {
        return config('app.uuid_prefix', 'SN') . $year . str_pad($number, 4, 0, STR_PAD_LEFT);
    }

    public function getSerialNumber($year)
    {
        return $this->model->whereYear('created_at', $year)->count() + 1;
    }

}
